//
//  UIBarButtonItem+Extension.swift
//  weibo27
//
//  Created by mac on 16/4/22.
//  Copyright © 2016年 it.cast. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    /// 遍历构造函数 自定义UIBarButtonItem
    convenience init(imageName:String, actionName:String?, target:AnyObject?){
        
        let button = UIButton(imageName: imageName, backGroudImage: nil)
        
        if let actionName = actionName{
            button.addTarget(target, action: Selector(actionName), forControlEvents: .TouchUpInside)
        }
        
        self.init(customView: button)
    }
}
